package kr.saeildamil.androidstudty.ch18;

import kr.saeildamil.androidstudty.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class ApplicationTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch18_applicationtest);
		
		updateNowMode();
	}

	private void updateNowMode() {
		TextView tv=(TextView) findViewById(R.id.ch18_application_mode);
		AndroidStudyApplication app=(AndroidStudyApplication) getApplication();
		
		if(app.getMode()==AndroidStudyApplication.BEGINNER){
			tv.setText("현재 모드 : 초보자  모드");
		}else{
			tv.setText("현재 모드 : 숙련자 모드");
		}
	}
	
	public void mOnClick(View v){
		AndroidStudyApplication app=(AndroidStudyApplication) getApplication();
		switch (v.getId()) {
		case R.id.ch18_application_beginner:
			app.setMode(AndroidStudyApplication.BEGINNER);
			break;
		case R.id.ch18_application_professional:
			app.setMode(AndroidStudyApplication.PROFESSIONAL);
			break;
		}
		updateNowMode();
	}
}

